/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 顶部搜索栏 */
.top-search {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.search-form {
    display: flex;
    width: 300px;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
}

.search-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.search-btn:hover {
    background: #ff5252;
}

/* 导航栏 */
.navbar {
    background: white;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.navbar-nav {
    display: flex;
    list-style: none;
}

.navbar-nav li {
    flex: 1;
    text-align: center;
}

.navbar-nav a {
    display: block;
    padding: 20px;
    text-decoration: none;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.navbar-nav a:hover {
    background: #f9f9f9;
    border-bottom: 3px solid #ff6b6b;
}

.navbar-nav a.active {
    color: #ff6b6b;
    border-bottom: 3px solid #ff6b6b;
}

/* 内容区域 */
.content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 页面标题 */
.page-title {
    font-size: 28px;
    color: #333;
    margin-bottom: 25px;
    border-bottom: 2px solid #ff6b6b;
    padding-bottom: 15px;
}

/* 产品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    background: white;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.product-info {
    padding: 15px;
}

.product-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.product-price {
    color: #ff6b6b;
    font-size: 18px;
    font-weight: bold;
}

.product-sold {
    color: #888;
    font-size: 14px;
    margin-top: 5px;
}

.badge {
    background: #ff6b6b;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
    margin-top: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .search-form {
        width: 100%;
    }

    .navbar-nav {
        flex-direction: column;
    }

    .navbar-nav li {
        width: 100%;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}


/* ========== 商品详情页样式 ========== */

/* 详情页主容器 */
.product-detail-container {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 主要信息区 (图片+信息) */
.product-main-info {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
}

/* 左侧图片区 */
.product-image-section {
    flex-shrink: 0;
}

/* --- 修改点 1: 固定商品主图大小 --- */
.product-image-section img {
    width: 400px;         /* 固定宽度 */
    height: 400px;        /* 固定高度，形成正方形 */
    object-fit: cover;    /* 关键属性：保持比例裁剪，不拉伸 */
    border-radius: 8px;
    border: 1px solid #eee;
}

/* 右侧信息区 */
.product-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 价格信息 */
.price-info {
    margin-bottom: 20px;
}

.current-price {
    font-size: 32px;
    color: #ff6b6b;
    font-weight: bold;
}

.original-price {
    font-size: 18px;
    color: #999;
    text-decoration: line-through;
    margin-left: 10px;
}

/* 元信息 (规格, 类型等) */
.meta-info p {
    font-size: 16px;
    line-height: 1.8;
    color: #555;
}

.meta-info strong {
    color: #333;
    width: 100px;
    display: inline-block;
}

/* 操作按钮 */
.action-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}

/* --- 修改点 2: 优化按钮样式 --- */
.btn {
    padding: 14px 30px;          /* 增加内边距，让按钮更大 */
    border: none;
    border-radius: 25px;         /* 更圆润的边角 */
    font-size: 16px;
    font-weight: 600;            /* 字体加粗 */
    cursor: pointer;
    transition: all 0.3s ease;   /* 平滑过渡效果 */
    min-width: 150px;            /* 设置最小宽度 */
    text-align: center;
}

.btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53); /* 添加渐变背景 */
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3); /* 添加阴影 */
}

.btn-primary:hover {
    background: linear-gradient(45deg, #ff5252, #ff7043); /* 悬停时改变渐变 */
    transform: translateY(-3px); /* 悬停时上移更多 */
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4); /* 悬停时加深阴影 */
}

.btn-secondary {
    background: #fff;
    color: #ff6b6b;
    border: 2px solid #ff6b6b;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: #ff6b6b;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

/* 商品详情介绍区 */
.product-description {
    border-top: 1px solid #eee;
    padding-top: 30px;
}

.product-description h2 {
    font-size: 22px;
    color: #333;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.description-text {
    font-size: 16px;
    line-height: 1.8;
    color: #555;
    margin-bottom: 20px;
}

.description-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* 详情页响应式设计 */
@media (max-width: 768px) {
    .product-main-info {
        flex-direction: column;
        gap: 20px;
    }

    /* --- 修改点 3: 响应式下调整主图大小 --- */
    .product-image-section img {
        width: 100%;       /* 宽度自适应 */
        height: 300px;     /* 给一个合适的高度 */
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
